<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>my_skynet: Sunnet Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">my_skynet
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classSunnet.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="classSunnet-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Sunnet Class Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a437f21dbd8b9e165b7f83c5a390413c5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a437f21dbd8b9e165b7f83c5a390413c5"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Sunnet</b> (const <a class="el" href="classSunnet.html">Sunnet</a> &amp;)=delete</td></tr>
<tr class="separator:a437f21dbd8b9e165b7f83c5a390413c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2187d4973b2207e793d1a418451b127a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2187d4973b2207e793d1a418451b127a"></a>
const <a class="el" href="classSunnet.html">Sunnet</a>&#160;</td><td class="memItemRight" valign="bottom"><b>operator=</b> (const <a class="el" href="classSunnet.html">Sunnet</a> &amp;)=delete</td></tr>
<tr class="separator:a2187d4973b2207e793d1a418451b127a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad3da9d9474976109f3ca56ae764a263d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad3da9d9474976109f3ca56ae764a263d"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#ad3da9d9474976109f3ca56ae764a263d">Start</a> ()</td></tr>
<tr class="memdesc:ad3da9d9474976109f3ca56ae764a263d"><td class="mdescLeft">&#160;</td><td class="mdescRight">入口函数 <br/></td></tr>
<tr class="separator:ad3da9d9474976109f3ca56ae764a263d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a48630e173ced99d2e0edb9a5dc49b3d5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a48630e173ced99d2e0edb9a5dc49b3d5"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>Wait</b> ()</td></tr>
<tr class="separator:a48630e173ced99d2e0edb9a5dc49b3d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a54f240a242f4ef768587c8c947ba5e2a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a54f240a242f4ef768587c8c947ba5e2a"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>NewService</b> (std::shared_ptr&lt; std::string &gt; type)</td></tr>
<tr class="separator:a54f240a242f4ef768587c8c947ba5e2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4323a7422ebab350b4af493a431491fc"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a4323a7422ebab350b4af493a431491fc">KillService</a> (uint32_t id)</td></tr>
<tr class="memdesc:a4323a7422ebab350b4af493a431491fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">只能由service自己调用，里面会调用service中的方法，线程不安全  <a href="#a4323a7422ebab350b4af493a431491fc">More...</a><br/></td></tr>
<tr class="separator:a4323a7422ebab350b4af493a431491fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab7e6397c09a8eb2823583e03bd661528"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#ab7e6397c09a8eb2823583e03bd661528">Send</a> (uint32_t dest_id, std::shared_ptr&lt; <a class="el" href="classBaseMsg.html">BaseMsg</a> &gt; msg)</td></tr>
<tr class="memdesc:ab7e6397c09a8eb2823583e03bd661528"><td class="mdescLeft">&#160;</td><td class="mdescRight">向目的service发送msg  <a href="#ab7e6397c09a8eb2823583e03bd661528">More...</a><br/></td></tr>
<tr class="separator:ab7e6397c09a8eb2823583e03bd661528"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58dfe55971a5ba93d777254c054440e7"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; <a class="el" href="classService.html">Service</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a58dfe55971a5ba93d777254c054440e7">PopGlobalQueue</a> ()</td></tr>
<tr class="memdesc:a58dfe55971a5ba93d777254c054440e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">从global_queue中弹出一个需要处理msg的service  <a href="#a58dfe55971a5ba93d777254c054440e7">More...</a><br/></td></tr>
<tr class="separator:a58dfe55971a5ba93d777254c054440e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90ad5612f54baa9c7910c7711cc41eec"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a90ad5612f54baa9c7910c7711cc41eec">PushGlobalQueue</a> (std::shared_ptr&lt; <a class="el" href="classService.html">Service</a> &gt; srv)</td></tr>
<tr class="memdesc:a90ad5612f54baa9c7910c7711cc41eec"><td class="mdescLeft">&#160;</td><td class="mdescRight">将一个需要处理msg的service放进global_queue  <a href="#a90ad5612f54baa9c7910c7711cc41eec">More...</a><br/></td></tr>
<tr class="separator:a90ad5612f54baa9c7910c7711cc41eec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a075ba56d648e7beb726cfddf64581593"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; <a class="el" href="classServiceMsg.html">ServiceMsg</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a075ba56d648e7beb726cfddf64581593">MakeMsg</a> (uint32_t source, char *buff, int len)</td></tr>
<tr class="memdesc:a075ba56d648e7beb726cfddf64581593"><td class="mdescLeft">&#160;</td><td class="mdescRight">临时构造ServiceMsg  <a href="#a075ba56d648e7beb726cfddf64581593">More...</a><br/></td></tr>
<tr class="separator:a075ba56d648e7beb726cfddf64581593"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a995cb65d66f6fee3667fe248a0eb8f2e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a995cb65d66f6fee3667fe248a0eb8f2e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a995cb65d66f6fee3667fe248a0eb8f2e">CheckAndWeakUp</a> ()</td></tr>
<tr class="memdesc:a995cb65d66f6fee3667fe248a0eb8f2e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send方法中调用 <br/></td></tr>
<tr class="separator:a995cb65d66f6fee3667fe248a0eb8f2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27842038d2fc4338d44539d95a9a576a"><td class="memItemLeft" align="right" valign="top">std::shared_ptr&lt; <a class="el" href="classService.html">Service</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#a27842038d2fc4338d44539d95a9a576a">GetService</a> (uint32_t id)</td></tr>
<tr class="memdesc:a27842038d2fc4338d44539d95a9a576a"><td class="mdescLeft">&#160;</td><td class="mdescRight">当global_queue中没有srv时，工作线程调用该方法  <a href="#a27842038d2fc4338d44539d95a9a576a">More...</a><br/></td></tr>
<tr class="separator:a27842038d2fc4338d44539d95a9a576a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a933d43dfa53a71613d60fb1e77e624e5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a933d43dfa53a71613d60fb1e77e624e5"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>WorkerWait</b> ()</td></tr>
<tr class="separator:a933d43dfa53a71613d60fb1e77e624e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7f229f00285bbf68baa9b09911c160d8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7f229f00285bbf68baa9b09911c160d8"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>AddConn</b> (int fd, uint32_t id, Conn::Type type)</td></tr>
<tr class="separator:a7f229f00285bbf68baa9b09911c160d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a5bae411d025f900eb7b0fdff5f632e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9a5bae411d025f900eb7b0fdff5f632e"></a>
std::shared_ptr&lt; <a class="el" href="classConn.html">Conn</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>GetConn</b> (int fd)</td></tr>
<tr class="separator:a9a5bae411d025f900eb7b0fdff5f632e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a17ec755e62710b6f1a7e675db6330273"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a17ec755e62710b6f1a7e675db6330273"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>RemoveConn</b> (int fd)</td></tr>
<tr class="separator:a17ec755e62710b6f1a7e675db6330273"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73fe43fd59623ba7020d7676cb28c90d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a73fe43fd59623ba7020d7676cb28c90d"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>Listen</b> (uint32_t port, uint32_t service_id)</td></tr>
<tr class="separator:a73fe43fd59623ba7020d7676cb28c90d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afab5f593cff45508f4e290990dda0b6a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afab5f593cff45508f4e290990dda0b6a"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>CloseConn</b> (uint32_t fd)</td></tr>
<tr class="separator:afab5f593cff45508f4e290990dda0b6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b6caead51659cbaeef4e758a88310c2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6b6caead51659cbaeef4e758a88310c2"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>ModifyEvent</b> (int fd, bool epoll_out)</td></tr>
<tr class="separator:a6b6caead51659cbaeef4e758a88310c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a961d69c9cf2ac01119b2a8bc3e85fea7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a961d69c9cf2ac01119b2a8bc3e85fea7"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>SendMsg2LogService</b> (std::shared_ptr&lt; <a class="el" href="classLogMsg.html">LogMsg</a> &gt; msg)</td></tr>
<tr class="separator:a961d69c9cf2ac01119b2a8bc3e85fea7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ad262ca0afa68db52846f39484c80291a"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classSunnet.html">Sunnet</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSunnet.html#ad262ca0afa68db52846f39484c80291a">GetInstance</a> ()</td></tr>
<tr class="memdesc:ad262ca0afa68db52846f39484c80291a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the Instance object.  <a href="#ad262ca0afa68db52846f39484c80291a">More...</a><br/></td></tr>
<tr class="separator:ad262ca0afa68db52846f39484c80291a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a952f4a90d681cc474d90649231938ed1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a952f4a90d681cc474d90649231938ed1"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>worker_num_</b> = common::WORKER_NUM</td></tr>
<tr class="separator:a952f4a90d681cc474d90649231938ed1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1afa1a7af752abcb78fc3409b9b940d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad1afa1a7af752abcb78fc3409b9b940d"></a>
std::vector&lt; std::shared_ptr<br class="typebreak"/>
&lt; <a class="el" href="classWorker.html">Worker</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>workers_vec_</b></td></tr>
<tr class="separator:ad1afa1a7af752abcb78fc3409b9b940d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace4e9ca8d82e73515a061806c0b216e0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ace4e9ca8d82e73515a061806c0b216e0"></a>
std::vector&lt; std::shared_ptr<br class="typebreak"/>
&lt; std::thread &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>worker_thread_vec_</b></td></tr>
<tr class="separator:ace4e9ca8d82e73515a061806c0b216e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31930ea652d6d1b02e85dc2e4c53f845"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a31930ea652d6d1b02e85dc2e4c53f845"></a>
pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><b>sleep_mutex_</b></td></tr>
<tr class="separator:a31930ea652d6d1b02e85dc2e4c53f845"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae4c9f59269e7e0f53af8964b26c78cf9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae4c9f59269e7e0f53af8964b26c78cf9"></a>
pthread_cond_t&#160;</td><td class="memItemRight" valign="bottom"><b>sleep_cond_</b></td></tr>
<tr class="separator:ae4c9f59269e7e0f53af8964b26c78cf9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ac612ac3c90e7831978b5743d635818"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2ac612ac3c90e7831978b5743d635818"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>sleep_count_</b> = 0</td></tr>
<tr class="separator:a2ac612ac3c90e7831978b5743d635818"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b43790e7e57c02edf035ac6d402a569"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3b43790e7e57c02edf035ac6d402a569"></a>
std::shared_ptr&lt; <a class="el" href="classSocketWorker.html">SocketWorker</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>socket_worker_</b></td></tr>
<tr class="separator:a3b43790e7e57c02edf035ac6d402a569"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1e25670a7a8e05982da962bfa485fb9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad1e25670a7a8e05982da962bfa485fb9"></a>
std::shared_ptr&lt; std::thread &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>socket_thread_</b></td></tr>
<tr class="separator:ad1e25670a7a8e05982da962bfa485fb9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d17ec806b09511f15a9e4c67b4ecc6b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3d17ec806b09511f15a9e4c67b4ecc6b"></a>
std::unordered_map&lt; uint32_t, <br class="typebreak"/>
std::shared_ptr&lt; <a class="el" href="classConn.html">Conn</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>conns_</b></td></tr>
<tr class="separator:a3d17ec806b09511f15a9e4c67b4ecc6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5806a1ae562341b6934d06e539ad0459"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5806a1ae562341b6934d06e539ad0459"></a>
pthread_rwlock_t&#160;</td><td class="memItemRight" valign="bottom"><b>conns_lock_</b></td></tr>
<tr class="separator:a5806a1ae562341b6934d06e539ad0459"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9bd7cc85bc19a5d694676865ee25c15a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9bd7cc85bc19a5d694676865ee25c15a"></a>
std::unordered_map&lt; uint32_t, <br class="typebreak"/>
std::shared_ptr&lt; <a class="el" href="classService.html">Service</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>service_map_</b></td></tr>
<tr class="separator:a9bd7cc85bc19a5d694676865ee25c15a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa0c029e695d354a1b24e55721135e01c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa0c029e695d354a1b24e55721135e01c"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>max_id_</b> = 0</td></tr>
<tr class="separator:aa0c029e695d354a1b24e55721135e01c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:add07371f5f7b9b884a74d14ed5a6df55"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="add07371f5f7b9b884a74d14ed5a6df55"></a>
pthread_rwlock_t&#160;</td><td class="memItemRight" valign="bottom"><b>services_lock_</b></td></tr>
<tr class="separator:add07371f5f7b9b884a74d14ed5a6df55"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a738835db588add5d9a3239ebb37bc7db"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a738835db588add5d9a3239ebb37bc7db"></a>
std::queue&lt; std::shared_ptr<br class="typebreak"/>
&lt; <a class="el" href="classService.html">Service</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>global_queue_</b></td></tr>
<tr class="separator:a738835db588add5d9a3239ebb37bc7db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6904c9876d78847ae2ae0211b95ff3df"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6904c9876d78847ae2ae0211b95ff3df"></a>
pthread_spinlock_t&#160;</td><td class="memItemRight" valign="bottom"><b>global_queue_lock_</b></td></tr>
<tr class="separator:a6904c9876d78847ae2ae0211b95ff3df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a479f85aa89c20a018b51a0a710620a2f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a479f85aa89c20a018b51a0a710620a2f"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>log_service_id_</b></td></tr>
<tr class="separator:a479f85aa89c20a018b51a0a710620a2f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ad262ca0afa68db52846f39484c80291a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classSunnet.html">Sunnet</a>&amp; Sunnet::GetInstance </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the Instance object. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classSunnet.html">Sunnet</a>&amp; </dd></dl>

</div>
</div>
<a class="anchor" id="a27842038d2fc4338d44539d95a9a576a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt;<a class="el" href="classService.html">Service</a>&gt; Sunnet::GetService </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>当global_queue中没有srv时，工作线程调用该方法 </p>
<p>Get the <a class="el" href="classService.html">Service</a> object</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>service id </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::shared_ptr&lt;Service&gt; </dd></dl>

</div>
</div>
<a class="anchor" id="a4323a7422ebab350b4af493a431491fc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Sunnet::KillService </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>只能由service自己调用，里面会调用service中的方法，线程不安全 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a075ba56d648e7beb726cfddf64581593"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt;<a class="el" href="classServiceMsg.html">ServiceMsg</a>&gt; Sunnet::MakeMsg </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>临时构造ServiceMsg </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">source</td><td></td></tr>
    <tr><td class="paramname">buff</td><td></td></tr>
    <tr><td class="paramname">len</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::shared_ptr&lt;ServiceMsg&gt; </dd></dl>

</div>
</div>
<a class="anchor" id="a58dfe55971a5ba93d777254c054440e7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::shared_ptr&lt;<a class="el" href="classService.html">Service</a>&gt; Sunnet::PopGlobalQueue </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>从global_queue中弹出一个需要处理msg的service </p>
<dl class="section return"><dt>Returns</dt><dd>std::shared_ptr&lt;Service&gt; </dd></dl>

</div>
</div>
<a class="anchor" id="a90ad5612f54baa9c7910c7711cc41eec"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Sunnet::PushGlobalQueue </td>
          <td>(</td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="classService.html">Service</a> &gt;&#160;</td>
          <td class="paramname"><em>srv</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>将一个需要处理msg的service放进global_queue </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">srv</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ab7e6397c09a8eb2823583e03bd661528"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Sunnet::Send </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>dest_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::shared_ptr&lt; <a class="el" href="classBaseMsg.html">BaseMsg</a> &gt;&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>向目的service发送msg </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dest_id</td><td>目的service id </td></tr>
    <tr><td class="paramname">msg</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/why/workspace/my_skynet/include/<a class="el" href="sunnet_8h_source.html">sunnet.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classSunnet.html">Sunnet</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
